/**
 * Author@ Cheng Feitian
 * Date: 2021-4-4
 * Description: 继承中的构造和析构顺序
 */

#include <algorithm>
#include <iostream>
#include <string>

using namespace std;
const int maxn = 1024;

class Base
{
public:
    Base()
    {
        cout << "Base构造函数！" << endl;
    }
    ~Base()
    {
        cout << "Base析构函数!" << endl;
    }
};

class Son : public Base
{
public:
    Son()
    {
        cout << "Son构造函数！" << endl;
    }
    ~Son()
    {
        cout << "Son析构函数！" << endl;
    }
};

void test01()
{
    //继承中的构造和析构顺序如下：
    //先构造父类，在构造子类，析构的顺序与构造的顺序相反
    Son son;
}

int main()
{
    test01();
    return 0;
}
